<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>订单统计</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" href="/css/modules.css" type="text/css"	media="screen" />
	<link rel="stylesheet" href="/css/modules1.css" type="text/css"	media="screen" />
	<link rel="stylesheet" href="/css/jquery-ui.css" type="text/css"	media="screen" />
	<link rel="stylesheet" href="/css/jquery.wysiwyg.css" type="text/css"	media="screen" />
	<style type="text/css">
		label{
			display:inline;
		}
		.input-medium{
			width:180px;
		}
		h2{
			font-size:16px;
		}
	</style>
	<script type='text/javascript' src="/js/jquery-1.4.2.min.js"></script>	
	<script type='text/javascript' src="/js/jquery.js"></script>
	<script type='text/javascript' src="/js/jquery-ui.js"></script>
	<script type='text/javascript' src="/js/jquery.wysiwyg.js"></script>
	<script type='text/javascript' src="/js/custom.js"></script>
	<script type='text/javascript'>
		var url;
		var dialogOption={height: 300,width:880,modal:true,position: [0,50]};
		function addPro(){
			jQuery("#addProduct").dialog(dialogOption);
			jQuery("#addProduct").dialog("open");
		}
		function findRecordByPid(pid){
			url="/RecordAction!findRecord.action?product.id="+pid;
			$("#getRecord").load(url,function(){
				jQuery("#getRecord").dialog();
				jQuery("#getRecord").dialog("open");
			});
			
		}
		function purchase(operate,pid){
			url="/ProductAction!getProduct.action?productid="+pid+"&operate="+operate;
			$("#purchase").load(url,function(){
				jQuery("#purchase").dialog();
				jQuery("#purchase").dialog("open");
			});
		}
		
		function editProduct(pid){
			url="/ProductAction!edit.action?productid="+pid;
			$("#editProduct form").load(url,function(){
				jQuery("#editProduct").dialog(dialogOption);
				jQuery("#editProduct").dialog("open");
			});
		}
		
			function loadCity(f){
			var provinceid=$(f).val();
			$("#cityspan").load("/area/province!getCity.action?provinceid='"+provinceid+"'");
			$("#regionspan").html("");
			$(f).attr("name","provinceid");
		//	$("#psel").attr("name","ff.dd");
		}
		
		function loadRegion(f){
			var cityid=$(f).val();
			$("#regionspan").load("/area/province!getRegion.action?cityid='"+cityid+"'");
			$("#psel").attr("name","");
			$(f).attr("name","provinceid");
		//	$("#csel").attr("name","");
		}

		function zz(f){
			
			$("#csel").attr("name","");
			$(f).attr("name","provinceid");
		//	$("#csel").attr("name","");
		}
		
	</script>
	
	<s:head theme="ajax"/>
  </head>
  
<body style="background-color:transparent">
	<!--  Goods_list header -->
	<div style="padding:10px;">
  		<h2 class="jquery_tab_title">
  			进货统计>>${accounts[0].product.name }
  			<s:if test="statisticalList[0].areaType.name=='市级'">
  				>>${account.province.name }
  			</s:if>
  			<span style="float:right;">
  				<form action="/base/StatisticalAction!list.action" >
  				<label>按日期查询</label>
  				<input type="text" class="input-medium" style="color:#999" value="格式如:2010-11-20" />
  				<input type="button" value="Search" class="button" />
  				<a href="##">高级查询</a></form>
  			</span>
  		</h2>
  	</div>
  	<!--  Goods_list  -->
  	<div>
  	<form action="/StatisticalAction!list.action" method="post">
  					<table id="noborder_table">
					<tr>
						<td id="areaSelect">
						<s:if test="#session.user.role.name=='销售经理'">
						<span id="cityspan">
							<s:select id="csel" list="%{provinceList}" listKey="id" listValue="name"
	theme="simple" cssClass="select" onchange="loadRegion(this);"
	headerValue="请选择区域" headerKey="0"></s:select>
						 </span>
						</s:if><s:else>
						<span id="provincespan">
							<s:select id="psel" list="%{provinceList}" listKey="id" listValue="name"
	theme="simple" cssClass="select" onchange="loadCity(this);"
	headerValue="请选择区域" headerKey="0"></s:select>
							 </span>
							<span id="cityspan"> </span>
						</s:else>
							
							<span id="regionspan"> </span>
						</td>
						<td>
							<s:datetimepicker name="startTime" theme="simple" value="today" displayFormat="yyyy-MM-dd"   />至
							<s:datetimepicker name="endTime" theme="simple" value="today"  displayFormat="yyyy-MM-dd"  />
						</td>
						<td>
							<input type="hidden" name="type" value="PURCHASE"/>
							<input type="submit" class="button" value="按区域查询" />
						</td>
					</tr>
				</table></form>
  		<table cellspadding="0" cellspacing="0" width="100%">
  			<tr>
  			<th class="th_first">货品编号</th>
  			<th>进货地区</th>
  			<th>数量</th>
  			<th>时间</th>
  			<th>操作</th></tr>
  			<s:iterator value="accounts">
  			<tr>
				<td class="td_first">${product.code }</td>
				<td>${province.name }</td>
				<td>${quantity }</td>
				<td><s:date name="date" format="yyyy/MM/dd" /></td>
				<td><a href="/AccountAction!getDetail.action?accountid=${id }">详细信息</a></td>
			</tr>
			</s:iterator>
  		</table>
  	
  	</div>
  	
   	<div style="padding:10px;">
   		<span style="float:left">
   		<!-- 
   			<input type="button" value="选中全部" class="button" />
   			<input type="button" value="批量删除" class="button"/>
   		 -->
   			
   		</span>
   		<span style="float:right">
   			${pagination }
   		</span>
   	</div>
   	
  
  </body>
</html>
